<template>
  <div>
    <el-table
            :data="tableData.slice((this.currentPage-1)*this.pageSize,this.pageSize*this.currentPage)"
            border
            style="width: 100%">
      <el-table-column
              fixed
              prop="or_id"
              label="订单ID"
              width="100">
      </el-table-column>
      <el-table-column
              prop="ber_id"
              label="用户ID"
              width="120">
      </el-table-column>
      <el-table-column
              prop="or_kind"
              label="服务类型"
              width="120">
        <template slot-scope="scope">
          <div v-html="format(scope.row.or_kind,0)"></div>
        </template>
      </el-table-column>
      <el-table-column
              prop="or_type"
              label="订单状态"
              width="120">
        <template slot-scope="scope">
          <div v-html="format(scope.row.or_type,1)"></div>
        </template>
      </el-table-column>
      <el-table-column
              prop="or_accept"
              label="平台受理状态"
              width="120">
        <template slot-scope="scope">
          <div v-html="format(scope.row.or_accept,2)"></div>
        </template>
      </el-table-column>
      <el-table-column
              prop="or_process"
              label="下一步流程"
              width="120">
      </el-table-column>
      <el-table-column
              prop="or_time"
              label="下单时间"
              width="200">
      </el-table-column>
      <el-table-column
              prop="or_product"
              label="产品名称"
              width="150">
      </el-table-column>
      <el-table-column
              prop="or_money"
              label="金额(元)"
              width="120">
      </el-table-column>
      <el-table-column
              prop="or_pay"
              label="是否付款"
              width="120">
        <template slot-scope="scope">
          <div v-html="format(scope.row.or_pay,3)"></div>
        </template>
      </el-table-column>
      <el-table-column
              fixed="right"
              label="操作"
              width="300">
        <template slot-scope="scope">
          <el-button type="text"
                     size="medium"
                     @click="accept(scope.row.or_id)"
                     :disabled="scope.row.or_type !== 0">接受</el-button>
          <el-button type="text"
                     size="medium"
                     @click="reject(scope.row.or_id)"
                     :disabled="scope.row.or_type === 2">拒绝</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="currentPage"
            :page-sizes="[5, 10, 15]"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="tableData.length">
    </el-pagination>
  </div>
</template>

<script>
  import axios from "axios";
  import mixin from "../../../mixin/server";


  export default {
    name: "Wait",
    mixins:[mixin],
    inject:['reload'],
    mounted() {
      this.ser_id = this.$store.getters.getInfo.ser_id
      let url = 'https://haotry.top/api/serviceSide/getNeedToAccpectOrders'
      axios.post(url,JSON.stringify({ser_id:this.ser_id}),{
        headers:{
          'Content-Type':'application/json'
        }
      }).then(res => {
        let data = res.data
        console.log(data)
        if(data.status === 200){
          this.tableData = data.data
        }
        else{

        }
      })
    },
    data(){
      return{
        tableData:[],
        currentPage: 1,
        pageSize : 5,
        ser_id : ''
      }
    }
  }
</script>

<style scoped>

</style>